<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>展示个人信息</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/flat-ui.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>


    <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="assets/css/lib/themify-icons.css" rel="stylesheet">
    <link href="assets/css/lib/mmc-chat.css" rel="stylesheet" />
    <link href="assets/css/lib/sidebar.css" rel="stylesheet">
    <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/lib/simdahs.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
</head>

<%--<script type="text/javascript">
    $(function () {
        $.ajax({
            type: 'post',
            url: "showUserInfo",
            data:{id:1}
        }).success(function (data) {
            console.log(data);
            console.log(data.nickname);
            document.form1.id.value = data.id;
            document.form1.name.value = data.name;
            document.form1.password.value = data.password;
            document.form1.address.value = data.address;
            document.form1.email.value = data.email;

        }).error(function () {
            alert("信息获取失败");
        });

    });
</script>
--%>
<body>
<div class="card alert" style="width: 50% ;margin: 50px auto;">
    <h3 style="text-align: center;font-size: 63px;font-weight: 800;letter-spacing: 0.451em;line-height: 1;">个人信息</h3>
    <form name="form1" action="updateUser" method="post" enctype="multipart/form-data" onsubmit="checkPassword()">
    <div class="demo-type-example" style="margin: 0 auto;height: 200px;width: 200px">
        <span class="demo-text-note">头像</span>
        <input type="file" name="upload">
        <img src="upload/${requestScope.user.img}" style="width: 150px;height: 150px" alt="example-image" class="img-rounded img-responsive">
    </div>



    <div class="form-group has-success has-feedback" style="margin-right: 20px;">
        <div class="row">
            <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">ID</label>
            <div class="col-sm-9" style="margin: 0;padding: 0;">
                <div class="input-group">
                    <span class="input-group-addon"><i class="ti-info"></i></span>
                    <input type="text" name="id" class="form-control" readonly="readonly" value="${requestScope.user.id}">
                </div>
            </div>
        </div>
    </div>
    <div class="form-group has-success has-feedback" style="margin-right: 20px;">
    <div class="row">
        <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">用户名</label>
        <div class="col-sm-9" style="margin: 0;padding: 0;">
            <div class="input-group">
                <span class="input-group-addon"><i class="ti-user"></i></span>
                <input type="text" name="name" class="form-control" value="${requestScope.user.name}">
            </div>
        </div>
    </div>
</div>
    <div class="form-group has-success has-feedback" style="margin-right: 20px;">
        <div class="row">
            <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">地址</label>
            <div class="col-sm-9" style="margin: 0;padding: 0;">
                <div class="input-group">
                    <span class="input-group-addon"><i class="ti-location-pin"></i></span>
                    <input type="text" name="address" class="form-control" value="${requestScope.user.address}">
                </div>
            </div>
        </div>
    </div>
    <div class="form-group has-success has-feedback" style="margin-right: 20px;">
        <div class="row">
            <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">email</label>
            <div class="col-sm-9" style="margin: 0;padding: 0;">
                <div class="input-group">
                    <span class="input-group-addon"><i class="ti-email"></i></span>
                    <input type="email" name="email" class="form-control" value="${requestScope.user.email}">
                </div>
            </div>
        </div>
    </div>

        <div class="form-group has-success has-feedback" style="margin-right: 20px;">
            <div class="row">
                <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">密码</label>
                <div class="col-sm-9" style="margin: 0;padding: 0;">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="ti-key"></i></span>
                        <input type="password" id="password" name="password" class="form-control" value="${requestScope.user.password}">
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group has-success has-feedback" style="margin-right: 20px;">
            <div class="row">
                <label class="col-sm-3 control-label" style="text-align: center;padding: 0;font-size: 22px;line-height: 1.9;margin: 0">确认密码</label>
                <div class="col-sm-9" style="margin: 0;padding: 0;">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="ti-key"></i></span>
                        <input type="password" id="confirm_password" class="form-control" value="${requestScope.user.password}">
                    </div>
                </div>
            </div>
        </div>






        <div class="col" style="width: 250px;margin: 0 auto">
            <input type="submit" value="确认修改" class="btn btn-block btn-lg btn-primary">
        </div>
    </form>

</div>
<script type="text/javascript">
    function checkPassword() {
        /*var pwd=document.getElementsByTagName("input");
        for(var i=0;i<pwd.length;i++){
          if(pwd[i].type=='password'&&pwd[i].value==0){
            alert("请输入密码！");
            pwd[i].focus();
            return false;
          }
        }*/
        var newPassword = document.getElementById("password");
        var rePasswourd = document.getElementById("confirm_password");
        if (newPassword.value !== rePasswourd.value) {
            // document.getElementById("sure2").disable = disable;
            // document.getElementById("sure2").innerHTML="两次密码不相同";
            alert("输入密码不一致，请重新输入！");
            rePasswourd.value = "";
            rePasswourd.focus();
            return false;
        }
    }
</script>
</body>


<script src="assets/js/lib/jquery.min.js"></script><!-- jquery vendor -->
<script src="assets/js/lib/jquery.nanoscroller.min.js"></script><!-- nano scroller -->
<script src="assets/js/lib/sidebar.js"></script><!-- sidebar -->
<script src="assets/js/lib/bootstrap.min.js"></script><!-- bootstrap -->
<script src="assets/js/lib/mmc-common.js"></script>
<script src="assets/js/lib/mmc-chat.js"></script>
<script src="assets/js/scripts.js"></script><!-- scripit init-->
</html>